package com.jinghang.wayofrich.common;

import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.SimpleAdapter;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.Volley;
import com.jinghang.wayofrich.R;
import org.json.JSONObject;

import java.util.HashMap;

public class NetCommon {
    public void request(View view){
        RequestQueue requestQueue = Volley.newRequestQueue(view.getContext());
        String url = UrlConstant.getReuqestUrl(UrlConstant.URL_GET_BANKS);
        HashMap<String, String> hashMap = new HashMap<String,String>();
        hashMap.put("status","1");//渠道状态（0-禁用 1-启用）
        hashMap.put("pageNum","0");//頁碼
        hashMap.put("pageSize","8");//每頁顯示數量
        hashMap.put("recommend","1");//是否首页显示（0-否 1-是）
        CustomRequest jsonObjectRequest = new CustomRequest(Request.Method.POST,
                url, hashMap, new Response.Listener<JSONObject>() {
            @Override
            public void onResponse(JSONObject jsonObject) {
                Log.d("获取银行结果",jsonObject.toString());
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                Log.d("请求出错",volleyError.getMessage());
            }
        });
        requestQueue.add(jsonObjectRequest);
    }
}
